<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
	<title>按企业设置医疗机构</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
 	
   
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>按企业设置医疗机构</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">目录管理</a></li>
            <li class="active"><a href="#">配送关系管理</a></li>
            <li class="active"><a href="#">设置配送关系</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">
                 <div class="form-group form-group-xs">
					<label>企业编码：</label> <input class="form-control" type="text" name="compCode" id="compCode" placeholder="企业编码"  /> 
				</div>
				<div class="form-group form-group-xs">
					<label>企业名称：</label> <input class="form-control" type="text" name="compName" id="compName" placeholder="企业名称" /> 
				</div>
                    <button type="button"  onclick="gridSerch()"  class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>
         
        <table class="jqgrid" id="gridlist"></table>
        <div id="prowed2"></div>
        
		<div class=" box box-warning bottongroup" id="bottongroup">
		<label  onclick="window.location.href='${ctx}/baseDel/toDelProdCompList.html'"   class="btn btn-default btn-sm" >返 回</label>
		</div>
		<form action="${ctx}/baseGoods/toSetDelRelationHosp.html" method="post" id="FormComp">
		<input type="hidden" id="delCompCode" name="delCompCode">
		<input type="hidden" id="compName1" name="compName">
		<input type="hidden" id="prodCompCode" name="prodCompCode"/>
		</form>
	<table class="jqgrid" id="gridlist"></table>
<div style="margin-top: 10px;"></div>
</section>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">
$(function () {
jQuery("#gridlist").jqGrid({
	url: "${ctx}/baseGoods/getTheDelCompList.html",
    mtype: "POST",
	datatype: "json",
	autowidth: true,
	height: 270,
   	colNames:['操作','企业编码','企业名称','组织机构代码','联系人','联系电话','医疗机构数'],
   	colModel:[
         {name:'oper',index:'formName', width:60, align:"center", sorttype:false,sortable:false,formatter:function(val,option,rowdata){
		var str = "<a href=\"javascript:toCompJsp('"+rowdata.comp_code+"','"+rowdata.comp_name+"','${param.compCode}')\" style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -20px -100px' class='opIcon' title='选择医疗机构'></a>";
		str += "<a href='${ctx}/baseGoods/toDelRelationHospLog.html?delCompCode="+rowdata.comp_code+"&compName="+rowdata.comp_name+"&prodCompCode=${param.compCode}' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='设置日志'></a>";
		return str;
	    }},
		{name:'comp_code',index:'compCode', width:100,align:"center", sorttype:false,sortable:false},
		{name:'comp_name',index:'compName', width:120, sorttype:"date",sortable:false,
   			formatter:function(val, opts,row) {
	   			 return "<a href=\"javascript:void(0);\" onclick=\"showCompInfo('"+row.comp_code+"', '"+ val +"')\">"+val+"</a>"
	   			}},
   		{name:'org_code',index:'orgCode', width:100,align:"center", sorttype:false,sortable:false},
   		{name:'contact_name',index:'contactName', width:80,align:"center", sorttype:false,sortable:false},
   		{name:'contact_telephone',index:'contactPhone', width:80, sorttype:false,sortable:false},
   		{name:'hospCount',index:'count', width:50, align:"center", sorttype:false,sortable:false,formatter:function(val,option,rowdata){

   			var str = "<a href='${ctx}/baseGoods/toDelRelationHospList.html?delCompCode="+rowdata.comp_code+"&compName="+rowdata.comp_name+"&prodCompCode=${param.compCode}'>"+val+"</a>";
	   			return str;
   		}}
   		
		
   	],
	 rowNum: 20,
     rowList: [10, 20, 50,100],
     rownumbers: true,
     pager: "#prowed2",
     viewrecords: true,
     caption: "${param.compCode}/${compName}",
     editurl:"proPlanItemListHis.jsp",
     jsonReader: {
         repeatitems: false,
         id: "comp_code"
     }
   	
});
	jQuery("#gridlist").jqGrid('navGrid',"prowed2",{edit:false,add:false,del:false});
});

function gridSerch() {
	var compCode = $.trim($("#compCode").val());
	var compName = $.trim($("#compName").val());
	$("#gridlist").jqGrid('setGridParam',{  
        datatype:'json',
        postData:{
        	"compCode":compCode,
        	"compName":compName}
    }).trigger("reloadGrid"); //重新载入  
}


function toCompJsp(delCompCode,compName,prodCompCode){
	$("#delCompCode").val(delCompCode);
	$("#compName1").val(compName);
	$("#prodCompCode").val(prodCompCode);
	$("#FormComp").submit();
}

</script>
</body>
</html>